/**
 * 
 */
package uk.co.altv.simpledb;

import java.util.List;
import java.util.Map;

/**
 * @author niki
 *
 */
public class RawReply implements IReply {

	private String payload;
	private boolean success;
	private String statusMessage;
	private int statusCode;

	/* (non-Javadoc)
	 * @see uk.co.altv.simpledb.IReply#setPayload(java.lang.String)
	 */
	public void setPayload(String payload) {
		this.payload = payload;
	}

	/* (non-Javadoc)
	 * @see uk.co.altv.simpledb.IReply#setHTTPContentEncoding(java.lang.String)
	 */
	public void setHTTPContentEncoding(String contentEncoding) {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see uk.co.altv.simpledb.IReply#setHTTPContentLength(int)
	 */
	public void setHTTPContentLength(int contentLength) {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see uk.co.altv.simpledb.IReply#setHTTPContentType(java.lang.String)
	 */
	public void setHTTPContentType(String contentType) {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see uk.co.altv.simpledb.IReply#setHTTPHeaderFields(java.util.Map)
	 */
	public void setHTTPHeaderFields(Map<String, List<String>> headerFields) {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see uk.co.altv.simpledb.IReply#setHTTPStatusCode(int)
	 */
	public void setHTTPStatusCode(int responseCode) {
		this.statusCode = responseCode;
	}

	/* (non-Javadoc)
	 * @see uk.co.altv.simpledb.IReply#setHTTPStatusMessage(java.lang.String)
	 */
	public void setHTTPStatusMessage(String responseMessage) {
		this.statusMessage = responseMessage;
	}

	/* (non-Javadoc)
	 * @see uk.co.altv.simpledb.IReply#setSuccess(boolean)
	 */
	public void setSuccess(boolean success) {
		this.success = success;
	}
	public String getPayload() {
		return payload;
	}

	public boolean getSuccess() {
		return success;
	}

	public String getHTTPStatusMessage() {
		return statusMessage;
	}

	public int getHTTPStatusCode() {
		return statusCode;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((payload == null) ? 0 : payload.hashCode());
		result = prime * result + statusCode;
		result = prime * result
				+ ((statusMessage == null) ? 0 : statusMessage.hashCode());
		result = prime * result + (success ? 1231 : 1237);
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RawReply other = (RawReply) obj;
		if (payload == null) {
			if (other.payload != null)
				return false;
		} else if (!payload.equals(other.payload))
			return false;
		if (statusCode != other.statusCode)
			return false;
		if (statusMessage == null) {
			if (other.statusMessage != null)
				return false;
		} else if (!statusMessage.equals(other.statusMessage))
			return false;
		if (success != other.success)
			return false;
		return true;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "RawReply [payload=" + payload + ", statusCode=" + statusCode
				+ ", statusMessage=" + statusMessage + ", success=" + success
				+ "]";
	}

}
